package com.swa99ylum.pxf;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;

import org.apache.poi.xssf.usermodel.XSSFRow;
import org.apache.poi.xssf.usermodel.XSSFSheet;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;

public class Test0 {

	
	public static void main(String[] args) throws Exception {
		
		File file = new File("test0.xlsx");
		System.out.println(file.getAbsolutePath());
		
		
		FileInputStream fis = new FileInputStream(file);
		XSSFWorkbook xwb = new XSSFWorkbook(fis);
		
		
		XSSFSheet sheet = xwb.getSheetAt(0);
		System.out.println(sheet.getSheetName());
		
		System.out.println(sheet.getFirstRowNum());
		System.out.println(sheet.getLastRowNum());
		
		System.out.println(sheet.getRow(0));
//		System.out.println(sheet.getRow(0).getFirstCellNum());
//		System.out.println(sheet.getRow(0).getLastCellNum());
		
		
		XSSFRow row = sheet.createRow(1);
		System.out.println(row.getFirstCellNum());
		System.out.println(row.getLastCellNum());
		
		row.createCell(0).setCellValue("123qwe");
		
		System.out.println(sheet.getRow(0)); //null
		
		
		FileOutputStream fo = new FileOutputStream(file);
		xwb.write(fo);
		fo.close();
		
	}
}
